home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / editors / origami / oridiff.zoo / tos.dif < prev   
Encoding:
Text File  |  1991-07-31  |  6.8 KB  |  245 lines

  1. *** foldmisc.c  Thu Jul 18 11:22:38 1991
  2. --- e:\tc\origami\src\tos\foldmisc.c    Mon Jul 29 10:17:52 1991
  3. ***************
  4. *** 9,14 ****
  5. --- 9,15 ----
  6. #  include <stat.h>    /* needed for struct stat */
  7. #  include <errno.h>
  8. #  include <tos.h>
  9. + #define FOLDMISC_C
  10. #  include "..\fold\fold_os.h"
  11.   /*}}}  */
  12.  
  13. ***************
  14. *** 153,155 ****
  15. --- 154,167 ----
  16.     version by Eric R. Smith if you wich to use these routines.
  17.   */
  18.   /*}}}  */
  19. +
  20. + char *newgetcwd(char *buf, int buflen)
  21. + {
  22. +   char *s;
  23. +   s = getcwd(buf,buflen);
  24. +   /* make sure there is no '\' at the end of the string */
  25. +   s+=strlen(s);
  26. +   if (s>buf && s[-1] == '\\')
  27. +     s[-1] = 0;
  28. +       return buf;
  29. + }
  30. *** keybutil.c  Thu Jul 18 11:22:40 1991
  31. --- e:\tc\origami\src\tos\keybutil.c    Sun Jul 21 22:18:08 1991
  32. ***************
  33. *** 12,14 ****
  34. --- 12,26 ----
  35.     system(command);
  36.   }
  37.   /*}}}  */
  38. + #include <stdio.h>
  39. + /*{{{  FILE *newfopen(const char *filename, const char *mode)*/
  40. + FILE *newfopen(const char *filename, const char *mode)
  41. + {
  42. +   FILE *stream;
  43. +
  44. +   stream = fopen(filename,mode);
  45. +   if (stream != NULL)
  46. +     setvbuf(stream,NULL,_IOFBF,10240L);
  47. +   return stream;
  48. + }
  49. + /*}}}  */
  50. *** st_utils.c  Thu Jul 18 11:22:42 1991
  51. --- e:\tc\origami\src\tos\st_utils.c    Wed Jul 31 14:47:56 1991
  52. ***************
  53. *** 13,18 ****
  54. --- 13,19 ----
  55. #  include <tos.h>
  56. #  include <vdi.h>
  57. #  include <aes.h>
  58. + #include "local\argparse.h"
  59. #  include "ori_rsc.h"
  60.  
  61. #  define ST_UTIL_C
  62. ***************
  63. *** 92,97 ****
  64. --- 93,99 ----
  65.   /*{{{  void newexit (int status) - replacement for library exit() function*/
  66.   void newexit (int status)
  67.   {
  68. +       int result,dummy,mbuf[16];
  69.     /*
  70.        it seems that we first have to get our messages before quitting the
  71.        program in order to avoid problems - so we use get_raw_key() instead
  72. ***************
  73. *** 98,105 ****
  74.        of Cconin()
  75.     */
  76.     if (status != 0)
  77. !     while(get_raw_key() != 13)
  78. !       ;
  79.     exit(status);
  80.   }
  81.   /*}}}  */
  82. --- 100,124 ----
  83.        of Cconin()
  84.     */
  85.     if (status != 0)
  86. !   {
  87. !     do
  88. !           /*{{{  evnt_multi */
  89. !           result = evnt_multi(MU_MESAG|MU_TIMER, 0,
  90. !                                0,0,
  91. !                                0,0,
  92. !                                0,0,
  93. !                                0,0,
  94. !                                0,0,
  95. !                                0,0,
  96. !                                mbuf, 1000,
  97. !                                0, &dummy,
  98. !                                &dummy, &dummy,
  99. !                                &dummy, &dummy,
  100. !                                &dummy );
  101. !           /*}}}  */
  102. !         while (result & MU_MESAG);
  103. !         Cconin();
  104. !   }
  105.     exit(status);
  106.   }
  107.   /*}}}  */
  108. ***************
  109. *** 122,127 ****
  110. --- 141,155 ----
  111.     appl_exit();
  112.   }
  113.   /*}}}  */
  114. + private int no_bak_files = 0; /* set by cmd line argument */
  115. + /*{{{  os_argtab[]*/
  116. + #define os_argnum 1
  117. +
  118. + private ARG os_argtab[os_argnum] =
  119. + {
  120. +   'B', BOOL_ARG, &no_bak_files
  121. + };
  122. + /*}}}  */
  123.   /*{{{  void st_init(int *argc, char **argv[])*/
  124.   void st_init(int *argc, char **argv[])
  125.   {
  126. ***************
  127. *** 244,249 ****
  128. --- 272,279 ----
  129.     }
  130.     /*}}}  */
  131.     *argv[0] = "origami";
  132. +   /* parse argv for additional, OS-specific arguments */
  133. +   *argc=argparse(*argc,*argv,os_argtab,os_argnum);
  134.   }
  135.   /*}}}  */
  136.  
  137. ***************
  138. *** 336,369 ****
  139.   /*}}}  */
  140.   /*{{{  void putenv(char *string) - set environment variables*/
  141.   /*
  142. !    This implementation of putenv simply does a system("setenv  ...").  This
  143. !    works well with MUPFEL, it should also work with other shells which stay
  144. !    resident in the background while executing  ORIGAMI  and  which maintain
  145. !    one global environment for  all  sub-shells. Has anyone a better idea of
  146. !    how to do this ?
  147.   */
  148.   void putenv(char *string)
  149.   {
  150. !   char buf[256];
  151. !   char *p=buf;
  152. !
  153. !   /* build command: setenv var "value" from string var=value */
  154. !   strcpy(buf,"setenv ");
  155.     while (*p)
  156.       p++;
  157. !   while (*string && *string != '=')
  158. !     *p++ = *string++;
  159. !   string++;
  160. !   *p++ = ' ';
  161. !   *p++ = '"';
  162. !   while (*string)
  163. !     *p++ = *string++;
  164. !   *p++ = '"';
  165. !   *p = 0;
  166.     system(buf);
  167.   }
  168.   /*}}}  */
  169. - int no_bak_files = 0; /* global, set by cmd line argument */
  170.   /*{{{  FILE *newfopen(const char *filename, const char *mode)*/
  171.   FILE *newfopen(const char *filename, const char *mode)
  172.   {
  173. --- 366,436 ----
  174.   /*}}}  */
  175.   /*{{{  void putenv(char *string) - set environment variables*/
  176.   /*
  177. !    Since system() calls the shell in memory which has started  ORIGAMI,  we
  178. !    cannot simply write  to  the  environment.  As  a  replacement,  we do a
  179. !    system() call  with  something like 'setenv "var=value"' - this will set
  180. !    the  shell's  environment. The only problem is that the command may  not
  181. !    contain some special characters - eg '"'. In order  to  make  this  work
  182. !    with every shell  without  recompilation,  this  part  of ORIGAMI can be
  183. !    configures by setting two environment variables before starting ORIGAMI:
  184. !    SHELL_SETENV and  SHELL_SETCONV. If these are not set, a default will be
  185. !    used which works with MUPFEL.
  186. !
  187. !    SHELL_SETENV contains the string which is passed to  sprintf().  It  may
  188. !    contain 2 ocurrences of %s - the first  is  the  environment variable to
  189. !    set and the second is the new value. "%s=%s" will produce something like
  190. !    "var=value",  "setenv  %s=\"%s\""  will  produce something like  "setenv
  191. !    var=\"val\"" etc.
  192. !
  193. !    SHELL_SETCONV controlls character substitution in 'val'. It may  contain
  194. !    pairs of characters - every ocurrence of the first character in a set is
  195. !    replaced by the second one.
  196.   */
  197.   void putenv(char *string)
  198.   {
  199. !   char buf[256],
  200. !        *val = string,
  201. !        *p,*p2,
  202. !        *format = getenv("SHELL_SETENV"),
  203. !        *convert = getenv("SHELL_SETCONV");
  204. !
  205. !   /*{{{  environment: set defaults if necessary*/
  206. !   if (format == NULL)
  207. !     format = "%s=\"%s\"";
  208. !   if (convert == NULL)
  209. !     convert = "\" ";
  210. !   /*}}}  */
  211. !   /*{{{  split up string into var. and value to set*/
  212. !   while (*val && *val != '=')
  213. !     val++;
  214. !   if (*val == 0)
  215. !     return;
  216. !   *val = 0;
  217. !   val++;
  218. !   /*}}}  */
  219. !   /*{{{  parse value and interpret SHELL_SETCONV to filter invalid chars*/
  220. !   p = val;
  221.     while (*p)
  222. +   {
  223. +     p2 = convert;
  224. +     while(p2[0] && p2[1])
  225. +     {
  226. +       if (*p2 == *p)
  227. +       {
  228. +         *p = *++p2;
  229. +         break;
  230. +       }
  231. +       p2 += 2;
  232. +     }
  233.       p++;
  234. !   }
  235. !   /*}}}  */
  236. !   /*{{{  build shell command, execute shell*/
  237. !   sprintf(buf,format,string,val);
  238.     system(buf);
  239. +   /*}}}  */
  240.   }
  241.   /*}}}  */
  242.   /*{{{  FILE *newfopen(const char *filename, const char *mode)*/
  243.   FILE *newfopen(const char *filename, const char *mode)
  244.   {
  245.